#pragma once
/*!
 * \file 
 * UtilSound.h
 */

#define BAD_DWORD (DWORD)-1
/*!
 * \brief Controlling volume of sound
 *
 * class for controlling volume
 *
 * - header file: UtilSound.h
 * - lib: util.lib
 * - DLL: util.dll
 */
class AFX_EXT_CLASS CUtilSound
{
private:
	UINT	m_uMixerID;
	DWORD	m_dwMixerHandle;

	DWORD	m_dwLineID;
	DWORD	m_dwVolumeControlID;
	int		m_nChannelCount;

	DWORD	m_dwMinimalVolume;
	DWORD	m_dwMaximalVolume;
	DWORD	m_dwVolumeStep;

public:
	CUtilSound(void);	/**< constructor 	*/
	~CUtilSound(void);	/**< destructor 	*/

private:
	int GetVolume();
	DWORD SetVolume(int nVolume);

	void Mute();
	void UnMute(DWORD dwVolume);


	// 
public:
	BOOL InitMasterVolume();	/**< Initialize volume control returns TRUE if successfully initiailized otherwise returns FALSE 	*/
	DWORD GetMasterVolume();	/**< returns current volume level which ranges from 0 to 65535 	*/
	void SetMasterVolume(DWORD dwValue); /**< set volume level which ranges from 0 to 65535 */

	DWORD GetMasterVolume2();
	BOOL SetMasterVolume2(DWORD dwValue);

	int GetMute();
	BOOL SetMute(BOOL bEnable);

private:
	BOOL DetectDevice();
};
